package cn.com.nes.site.entity.vo.workOrder;

import cn.com.nes.site.entity.vo.PageVO;
import cn.hutool.core.util.StrUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Set;

/**
 * 查询安装工单分页VO
 *
 * @Author: ShenWei
 * @Date: 2024/05/23/9:57
 */
@Data
public class GetWorkOrderInstallPageVO extends PageVO {

    @ApiModelProperty("公司ID")
    private String companyId;

    @ApiModelProperty("工单状态")
    private String workOrderState;

    @ApiModelProperty("项目id")
    private Long projectId;

    @ApiModelProperty("项目名称")
    private String projectName;
    @ApiModelProperty("行政区划代码")
    private String xzqhdm;

    @ApiModelProperty("项目类型")
    private String projectType;

    @ApiModelProperty("项目状态")
    private String projectStatus;

    @ApiModelProperty("派单时间 - 开始")
    private String dispatchTimeStart;

    @ApiModelProperty("派单时间 - 结束")
    private String dispatchTimeEnd;

    @ApiModelProperty("客户姓名")
    private String customerName;

    @ApiModelProperty("施工人员id")
    private Long maintainId;

    @ApiModelProperty("审核状态")
    private Integer audited;

    @ApiModelProperty("紧急程度id")
    private Integer emergencyDegreeId;

    @ApiModelProperty("是否合格")
    private int qualified;

    @ApiModelProperty(value = "是否可撤销 true - 可以撤销")
    private Boolean canCancel;

    @ApiModelProperty("安装工单类型")
    private Long workOrderType;

    @ApiModelProperty("派单时间起始时间戳")
    private Long dispatchTimeStartStamp;

    @ApiModelProperty("派单时间截至时间戳")
    private Long dispatchTimeEndStamp;

    @ApiModelProperty(value = "安装工单id集合", hidden = true)
    private Set<Long> workOrderIdSet;

    @ApiModelProperty(value = "安装工单状态码列表", hidden = true)
    private List<String> statusList;

    @ApiModelProperty("公司类型")
    private String companyType;

    @ApiModelProperty(value = "行政区划代码集合", hidden = true)
    private Set<String> workOrderAreaCodeSet;

    @ApiModelProperty(value = "是否按行政区划过滤-默认为是", required = true)
    private Boolean filterByAreaCode = true;

    @ApiModelProperty(value = "行政区划代码")
    private String areaCode;


    // 转换时间格式
    public void formatTime() throws Exception{
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        if (StrUtil.isNotBlank(this.dispatchTimeStart)) {
            this.dispatchTimeStartStamp = format.parse(this.dispatchTimeStart).getTime();
        }
        if (StrUtil.isNotBlank(this.dispatchTimeEnd)) {
            this.dispatchTimeEndStamp = format.parse(this.dispatchTimeEnd).getTime();
        }
    }
}
